/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-03-29
 * Time: 9:31
 * To BE A Better Person-2020-3-2
 *
 */
class HasStatic {// 1
    private static int x = 100;// 2
    public static void main(String args[]) {// 3
        HasStatic hsl = new HasStatic();// 4
        hsl.x++;// 5
        HasStatic hs2 = new HasStatic();// 6
        hs2.x++;// 7
        hsl = new HasStatic();// 8
        hsl.x++;// 9
        HasStatic.x--;// 10
        System.out.println(" x=" + x);// 11
    }
}
class Test{
    @Override
    public String toString() {
        System.out.println("aaa");
        return "bbb";
    }
}

class TestDemo1{

    private int count;

    public static void main(String[] args) {

        TestDemo1 test=new TestDemo1(88);

        System.out.println(test.count);

    }

    TestDemo1(int a) {

        count=a;

    }

}
//public class Test {
//    public int aMethod(){
//        static int i = 0;
//        i++;
//        return i;
//    }
//    public static void main(String args[]){
//        Test test = new Test();
//        test.aMethod();
//        int j = test.aMethod();
//        System.out.println(j);
//    }
//}
public class TestDemo {


    public static void main(String[] args) {
        System.out.println(new Test());
    }
    //给定一个非空整数数组，除了某个元素只出现一次以外，其余每个元素均出现两次。找出那个只出现了一次的元素。
    public static void main2(String[] args) {
        int[] arr={1,2,2,4,4};
        boolean k=true;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length; j++) {
                if(i==j){
                    break;
                }
                if(arr[i]==arr[j]){
                    k=false;
                }
            }
            if(k){
                System.out.print(arr[i]+" ");
            }
        }
    }

    public static int BinarySearch(int[] arr,int a){
        int left = 0;
        int right = arr.length - 1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if(arr[mid] < a) {
                left = mid+1;
            }else if(arr[mid] == a) {
                return mid;
            }else {
                right = mid-1;
            }
        }

        return -1;

    }
    public static void BubbleSort(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    int temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
    }
    public static boolean Is_Sort(int[] arr){
        boolean t=true;
        for (int i = 0; i < arr.length-1; i++) {
            if(arr[i]<=arr[i+1]){
                continue;
            }else{
                t = false;
                break;
            }
        }
        return t;
    }
    public static void main1(String[] args) {
        int[] arr={2,5,78,3,6,10,45};
        BubbleSort(arr);
        int index=BinarySearch(arr,3);
        System.out.println(index);
    }
}
